#include <stdio.h>
#include <stdlib.h>
#include "patterns.h"

int main( void )
{
    RYTHMS_t rythms[2];
    BOOL last_rythm;
    BOOL last_pattern;
    char * owns_pattern[] = { "wop", "wup" };
    char * pum_pattern[] = { "pim", "pom" };
    RYTHMS_t * now_rythm;
    char ** now_pattern;
    
    strcpy( rythms[0].name, "owns" );
    ContainerInit( & rythms[0].ctai_patterns, owns_pattern, sizeof( owns_pattern ), sizeof( * owns_pattern ), FALSE );
    
    strcpy( rythms[1].name, "pum" );
    ContainerInit( & rythms[1].ctai_patterns, pum_pattern, sizeof( pum_pattern ), sizeof( * pum_pattern ), FALSE );
    

    ContainerInit( & ctai_rythms, rythms, sizeof( rythms ), sizeof( * rythms ), FALSE );

    last_rythm = FALSE;
    while ( 1 )
    {
        now_rythm = ((RYTHMS_t *) ContainerGetElement( & ctai_rythms ) );
        printf( "\n%s\n", now_rythm->name );

        last_pattern = FALSE;
        while ( 1 )
        {
            now_pattern = ContainerNextElement( & now_rythm->ctai_patterns, & last_pattern );
        
            puts( * now_pattern );

            if ( last_pattern )
                break;
        }

        ContainerNextElement( & ctai_rythms, & last_rythm );
        if ( last_rythm )
            break; 
    }



    getchar();
    return 0;
}
